package com.njuse.jvmfinal.Instruction;

import java.nio.ByteBuffer;

import com.njuse.jvmfinal.runtimestructure.Jframe;

public class DSTORE_N extends Instruction {
	private int index;
	
	public DSTORE_N(int n) {
		 this.index=n;
	}
	
	public  void readindex(ByteBuffer reader) {
	  //pass
	}
	
	public  void execute(Jframe frame) {
		int top=frame.getStacktop();
		Object[] stack=frame.getManagestack();
		Object high=stack[top-1];
		Object low=stack[top-2];
		top=top-2;
		frame.setStacktop(top);
		Object[] local=frame.getLocal();
		local[index]=low;
		local[index+1]=high;
		frame.setLocal(local);
	}
}
